///网络访问的业务封装
import Request from '../../utils/request';
import GeewiResposeData from './GeewiResposeData';
///请求数据的封装类 err返回 {code:number,msg:string}
async function geewiRequest<T>(path: string, params?: {}) {
  let response = await Request.post<GeewiResposeData<T>>(path, params);
  return new Promise<T>((resolve, reject) => {
    if (response.data.code == 0) {
      resolve(response.data.data as T);
    } else {
      reject(response.data);
    }
  });
}
export default geewiRequest;
